import axios from '@/requset/requset'
import qs from 'qs'

//获取精品推荐的数据
export const JingpinAPI = () => axios.get("/products/recommend")

//获取热门推荐的数据
export const HotAPI = () => axios.get("/products/hot")

export const SendSMSAPI = (params) => axios.post("/sendSMS", qs.stringify(params))

// console.log('序列化', qs.stringify({
//     a:10,b:100
// }))
export const PhoneLoginAPI = (params) => axios.post("/phoneRegin", qs.stringify(params))

//微信扫码登录Api
export const weiXinLoginAPI = (params) => axios.post("/wechatUsers/PCLogin", qs.stringify(params))

//手机绑定微信请求
export const BindPhoneAPI = (params) => axios.post("/wechatUsers/binding", qs.stringify(params))

//获取用户信息
export const UserProfilesAPI = () => axios.get("/shop/userProfiles")

//请求详情页的数据
export const GoodDetailsAPI = (params) => axios.get(`/products/${params}`)

//加入购物车
export const AddToCartApi = (params) => axios.post("/shop/carts/add", qs.stringify(params))

//商品搜索（含首页的“更多”）
export const GoodsSearchApi = (params) => axios.get(`/products`, {
    params
})

//购物车数据  CartDataApi 
export const CartDataApi = () => axios.get("/shop/carts")